<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../day06/cssReset.css">
    <link rel="stylesheet" href="./list.css">
    <link rel="stylesheet" href="./icon-style.css">
    <script src="./data.js"></script>
</head>


<body>
    <div class="part">
        <div class="center">
            <h1>pokemon列表</h1>
            <table>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>图标</th>
                        <th>名字</th>
                    </tr>
                </thead>
                <tbody id="mybody">
                    <tr>
                        <td>001</td>
                        <td>
                            <div class="sprite-icon sprite-icon-001"></div>
                        </td>
                        <td>妙蛙种子</td>
                        <td></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</body>
<script>
    //获取mybody为了往这里插入遍历的tr

    var mybody = document.getElementById('mybody');
    var str = '';
    for (var i = 0; i < data.length; i++) {
        str += `
           <tr>
             <td>${data[i].id}</td>
                    <td>
                    <div class="sprite-icon sprite-icon-${data[i].id}"></div>
                    </td>
            <td>${data[i].name}</td>
         </tr>
       `
    }
    mybody.innerHTML = str;
</script>

</html>